using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using System.Resources;
using System.Globalization;

namespace LPV_POS.mh_pos.mh_doanhthu
{
    public partial class mh_tungaydenngay : DevExpress.XtraEditors.XtraForm
    {
        xulyngaythangnam ngaythang;
        public string str_fromdate = "";
        public string str_todate = "";
        public DateTime date_fromdatetime;
        public DateTime date_todatetime;
        CultureInfo culture;

        #region "Muti language"

        private void SetLanguage_banhang(string cultureName)
        {
            try
            {
                culture = CultureInfo.CreateSpecificCulture(cultureName);
                ResourceManager rm = new ResourceManager("LPV_POS.Muti_language.MyResource", typeof(mh_banhang6_PhuThu).Assembly);
                label3.Text = rm.GetString("tungay", culture);
                label1.Text = rm.GetString("denngay", culture);
                button2.Text = rm.GetString("chon", culture);
                button1.Text = rm.GetString("thoat", culture);
                this.Text = rm.GetString("chontungaydenngay", culture);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Note");
            }

        }

        #endregion

        public mh_tungaydenngay()
        {
            InitializeComponent();
            culture = CultureInfo.CurrentCulture;
        }

        private void bton_tungaydenngay_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void mh_tungaydenngay_Load(object sender, EventArgs e)
        {
            cpublic ocpublic = new cpublic();
            string str_lang = ocpublic.Registry_Get("mh_main_lang");
            if (str_lang == "")
                str_lang = "vi-VN";
            SetLanguage_banhang(str_lang);
            date_tungay.DateTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0);
            date_denngay.DateTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 23, 59, 59);
        }

        private void lbel_calendar_Click(object sender, EventArgs e)
        {
            date_tungay.ShowPopup();
        }

        private void label2_Click(object sender, EventArgs e)
        {
            date_denngay.ShowPopup();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            ngaythang = new xulyngaythangnam();
            str_fromdate = ngaythang.chuyenngay(date_tungay.Text);
            str_todate = ngaythang.chuyenngay(date_denngay.Text);
            date_fromdatetime = date_tungay.DateTime;
            date_todatetime = date_denngay.DateTime;
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
    }
}